
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import Cookies from 'js-cookie'
import ElementPlus from 'element-plus'
import 'element-plus/theme-chalk/index.css'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'element-plus/dist/index.css'
import '@/assets/styles/common.scss' // global css
import {watchWebview,getSendObject} from '@/utils/util'
import App from './App.vue'
import {router} from './router'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import input from '@/directive/input'

const app = createApp(App)
app.use(createPinia())
app.use(router)

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.directive('input', input );
// 使用element-plus 并且设置全局的大小
app.use(ElementPlus, {
    locale: zhCn,
    // 支持 large、default、small
    size: 'default',// Cookies.get('size') || 'default',
  })

app.mount('#app')

try{
  getSendObject()//把qt交互对象挂载到window上
  watchWebview()//监听webview返回的数据
}catch(e){
  alert(''+e)
}
